package com.base.vistter.iframe.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.base.vistter.iframe.converter.AlarmStatusConverter;
import com.base.vistter.iframe.converter.DateConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName(value = "inverter_alarm")
@HeadRowHeight(28)
@ContentRowHeight(22)
public class InverterAlarm extends BaseEntity {

    @ColumnWidth(25)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ExcelProperty(value = "报警开始时间", order = 8, converter = DateConverter.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date beginTime;

    @ColumnWidth(25)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ExcelProperty(value = "报警结束时间", order = 9, converter = DateConverter.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @ColumnWidth(15)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    @ExcelProperty(value = "报警状态", order = 1, converter = AlarmStatusConverter.class)
    private Integer status;

    private Integer inverterDevicesId;

    @ColumnWidth(25)
    @ExcelProperty(value = "电站名称", order = 2)
    @TableField(exist = false)
    @ContentStyle(verticalAlignment = VerticalAlignmentEnum.CENTER)
    private String stationName;

    @ColumnWidth(18)
    @ExcelProperty(value = "设备序号", order = 3)
    @TableField(exist = false)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    private String no;

    @ColumnWidth(18)
    @ExcelProperty(value = "设备编码", order = 4)
    @TableField(exist = false)
    @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER)
    private String code;

    @ColumnWidth(30)
    @ExcelProperty(value = "告警名称", order = 6)
    @TableField(exist = false)
    @ContentStyle(verticalAlignment = VerticalAlignmentEnum.CENTER)
    private String name;

    @ColumnWidth(30)
    @ExcelProperty(value = "告警英文名", order = 7)
    @TableField(exist = false)
    @ContentStyle(verticalAlignment = VerticalAlignmentEnum.CENTER)
    private String nameEs;

    @TableField(exist = false)
    @ExcelIgnore
    private List<InverterAlarmDetails> children = new ArrayList<InverterAlarmDetails>();


}
